


function commonLoadingUpPicture(type) {

	var formData = new FormData();
	formData.append('file', $('#file')[0].files[0]);
	formData.append('filType', type);
	$.ajax({
		url : upLoadFileToNetUrl,
		type : 'POST',
		cache : false,
		data : formData,
		processData : false,
		contentType : false
	}).done(function(json) {
		if (json != null && json != "") {
			var result =JSON.parse(json);
			var code = result.code;
			if (code == "1000") {
				$("#image_url").val(result.content);
				$("#title_picture").html("上传图片成功 路径 ："+result.content);

				console.log("上传图片成功 ");
			} else {
				console.log("上传图片操作异常  " + result.message);
			}

		} else if (json.status == "fail") {
			console.log("上传图片失败 ");
		} else {
			console.log("上传图片失败 ");
		}
	}, 'json').fail(function() {
		console.log("失败 请检查网络 ");
	});

}


function commonLoadingUpVideo(token,call) {

	var formData = new FormData();
	formData.append('file', $('#file')[0].files[0]);
	formData.append('filType', "video");
	formData.append("token",token);
	$.ajax({
		url : "http://up.qiniu.com/",
		type : 'POST',
		cache : false,
		data : formData,
		processData : false,
		contentType : false
	}).done(function(json) {
		if (json != null && json != "") {
			var hash = json.hash;
			var key = json.key;
			var mimeType = json.mimeType;
			var list = mimeType.split("/"); 
			var type=".avi";
			if(list==null||list.length<=1){
				
			}else{
				var i=list[0];
				var y=list[1];
				type="."+y;
			}
			console.log("hash is "+hash);
			console.log("key is "+key);
			call(hash,type);

		} else if (json.status == "fail") {
			console.log("上传视频失败 ");
		} else {
			console.log("上传视频失败 ");
		}
	}, 'json').fail(function() {
		console.log("失败 请检查网络 ");
	});

}
function commonLoadingUpPictureAndPara(fileId,resultId,type,successCall,faileCall) {

	var formData = new FormData();
	formData.append('file', $(fileId)[0].files[0]);
	formData.append('filType', type);
	$.ajax({
		url : upLoadFileToNetUrl,
		type : 'POST',
		cache : false,
		data : formData,
		processData : false,
		contentType : false
	}).done(function(json) {
		if (json != null && json != "") {
			var result =JSON.parse(json);
			var code = result.code;
			if (code == "1000") {
				$(resultId).val(result.content);
				$("#title_picture").html("上传图片成功 路径 ："+result.content);

				console.log("上传图片成功 ");

				if(successCall!=null&&successCall!=""){
					successCall(code, result.message,result.content);
				}

			} else {
				if(faileCall!=null&&faileCall!=""){
					faileCall(code, result.message,result.content);
				}
				console.log("上传图片操作异常  " + result.message);
			}

		} else if (json.status == "fail") {
			console.log("上传图片失败 ");
			if(faileCall!=null&&faileCall!=""){
				faileCall("1008", "网络异常","网络异常");
			}

		} else {
			console.log("上传图片失败 ");
			if(faileCall!=null&&faileCall!=""){
				faileCall("1008", "网络异常","网络异常");
			}
		}
	}, 'json').fail(function() {
		console.log("失败 请检查网络 ");
		if(faileCall!=null&&faileCall!=""){
			faileCall("1008", "网络异常","网络异常");
		}
	});

}